<!--
 * @Author: your name
 * @Date: 2020-12-16 18:15:30
 * @LastEditTime: 2020-12-18 11:34:25
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \basicjs\dom\jiedianInfo\outer.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>outerHTML</title>
</head>
<body>
    <!-- <div id="app">
        <div class="houdunren" data="hd">houdunren.com</div>
        <div class="hdcms">hdcms.com</div>
    </div> -->

    <div id="app">
        houdunren.comn
    </div>

    <script>
        //outerHTML与InnerHTML的区别就是包含父标签
        //outerHTML不会删除原来的元素
        //只是用新的内容替换旧的内容，旧的内容也就是元素是依然存在的

        // let app = document.querySelector(`#app`);
        // console.log(app);
        // let out = app.outerHTML;
        // let newApp = app.outerHTML = '<h1>后盾人</h1>';
        // console.log(newApp)

        //使用innerHTML内容是被删除然后使用新的内容
        // const app = document.querySelector(`#app`);
        // console.log(app);
        // app.innerHTML = 'hdcms.com';
        // console.log(app)

        //使用outerHTML是保留旧的内容，页面中使用新内容
        // const app = document.querySelector(`#app`);
        // console.log(app);
        // app.outerHTML = 'hdcms.com';
        // console.log(app);
    </script>
</body>
</html>